From: Mathias Gug <mathiaz@ubuntu.com>, Steve Langasek <vorlon@debian.org>
Subject: Enable net usershares by default at build time

Enable net usershares by default at build time, with a limit of 100, and update
the corresponding documentation.

Bug-Debian: http://bugs.debian.org/443230
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/samba/+bug/128548
Forwarded: not-needed
---
 docs-xml/smbdotconf/misc/usersharemaxshares.xml | 2 +-
 lib/param/loadparm.c                            | 2 ++
 source3/param/loadparm.c                        | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/docs-xml/smbdotconf/misc/usersharemaxshares.xml b/docs-xml/smbdotconf/misc/usersharemaxshares.xml
index 0d69bb8..e985857 100644
--- a/docs-xml/smbdotconf/misc/usersharemaxshares.xml
+++ b/docs-xml/smbdotconf/misc/usersharemaxshares.xml
@@ -9,5 +9,5 @@
 	</para>
 
 </description>
-<value type="default">0</value>
+<value type="default">100</value>
 </samba:parameter>
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index a221e87..c5367fd 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -2966,6 +2966,8 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
 
 	lpcfg_do_global_parameter(lp_ctx, "init logon delay", "100");
 
+	lpcfg_do_global_parameter(lp_ctx, "usershare max shares", "100");
+
 	lpcfg_do_global_parameter(lp_ctx, "usershare owner only", "yes");
 
 	lpcfg_do_global_parameter(lp_ctx, "-valid", "yes");
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index d5b1c56..5cd0a18 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -847,7 +847,7 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
 	lpcfg_string_set(Globals.ctx, &Globals.usershare_path, s);
 	TALLOC_FREE(s);
 	lpcfg_string_set(Globals.ctx, &Globals.usershare_template_share, "");
-	Globals.usershare_max_shares = 0;
+	Globals.usershare_max_shares = 100;
 	/* By default disallow sharing of directories not owned by the sharer. */
 	Globals.usershare_owner_only = true;
 	/* By default disallow guest access to usershares. */
